package com.qianli.cashmama.trade.unique;

import com.qianli.cashmama.trade.common.enums.UniqueStatusEnum;
import com.qianli.cashmama.trade.domain.model.TradeBase;

/**
 * 唯一性服务
 * 后续幂等服务 统一到这里 抽象
 * <p>
 * Created by scrack on 2017/7/21.
 */
public interface TradeUniqueService {
    /**
     * @param tradebase
     * @return
     */
    UniqueStatusEnum uniqueDecide(TradeBase tradebase);

    UniqueStatusEnum uniqueDecideByType(String productCategory, String tradeNo, String userCode, Integer eventType);


    /**
     * 释放唯一锁
     *
     * @param tradebase
     * @return
     */
    boolean releaseUniqueLock(TradeBase tradebase);

    boolean releaseUniqueLock(String userCode, String categoryCode, String tradeNo, Integer type);
}
